package com.rq.demo.controller;

import android.os.Bundle;
import android.view.View;

import com.rq.base.ui.BaseController;
import com.rq.base.ui.impl.CtrListener;
import com.rq.base.ui.impl.CtrTag;
import com.rq.base.ui.impl.OnClick;
import com.rq.base.util.LOG;
import com.rq.demo.R;

import static com.rq.demo.controller.Fra2.ACTION_INPUT_NUM;

public class Fra1 extends BaseController implements View.OnClickListener, CtrListener {
    @Override
    public int getLayoutId() {
        return R.layout.fra_1;
    }

    @Override
    public void onViewCreated(Bundle savedInstanceState) {
        super.onViewCreated(savedInstanceState);
        if (getPass(0) != null) {
            setData2View(R.id.tv, getInput(R.id.tv) + getPass(0));
        }
    }

    @Override
    @OnClick({R.id.tv})
    public void onClick(View v) {
        finishOK(getPass(0) + "---" + System.currentTimeMillis());
    }


    @Override
    @CtrTag({ACTION_INPUT_NUM})
    public void tagInfo(String tag, Object[] object) {
        if (ACTION_INPUT_NUM.equals(tag)) {
            LOG.e("Fra1", "36:" + object[0]);
            setData2View(R.id.pan, getInput(R.id.pan) + object[0]);
        }
    }
}
